package day0927;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Ques1026 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<Integer> list = new ArrayList<Integer>();
		List<Integer> resultList = new ArrayList<Integer>();
		while(scan.hasNext()){
			int num = scan.nextInt();
			int result = 0;
			if(num == 0){
				for(int re : resultList){
					System.out.println(re);
				}
			}else{
				for(int i = 0; i < num;i++){
					list.add(scan.nextInt());
				}
				for(int a : list){
					result += (a * a);
				}
				resultList.add(result);
				list = new ArrayList<Integer>();
			}
		}
	}
}
